package com.smh.a06comprehensiveExercises;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class Test4 {
    public static void main(String[] args) throws ParseException {
//        jdk7

        String birstr="2004年10月26日";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        Date parse = simpleDateFormat.parse(birstr);
        //毫秒值
        Long bir = parse.getTime();
        System.out.println(bir);

        Date date = new Date();
        Long today = date.getTime();

        System.out.println((today-bir)/1000/3600/24);

        //jdk8

        LocalDateTime bir1 = LocalDateTime.of(2004,10,26,0,0,0);
        LocalDateTime today1= LocalDateTime.now();
        System.out.println(ChronoUnit.DAYS.between(bir1,today1));

    }
}
